package com.yhb.channel.exception;

import com.fasterxml.jackson.annotation.JsonSetter;
import com.yhb.channel.model.BankCard;
import com.yhb.channel.model.IBankCard;
import com.yhb.channel.utils.ChannelJSONUtil;
import lombok.*;

import java.math.BigDecimal;
import java.util.HashMap;

/**
 * 当remit时发现需要绑卡时抛出
 */

@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class RemitCardUnboundException extends Exception {
    String msg;
    String smsToken;
    String channelName;
    String channelType;
    String userId;
    IBankCard remitCard;
    BigDecimal amount;
    BigDecimal userFeeAmount;

    @JsonSetter("remitCard")
    public void setRemitCard(HashMap payCard) {
        this.remitCard = ChannelJSONUtil.parseJson(payCard, BankCard.class);
    }
}
